package com.neu.fenli2023623.service.impl;

import com.neu.fenli2023623.dto.DoctorDto;
import com.neu.fenli2023623.entity.Doctor;
import com.neu.fenli2023623.mapper.DoctorMapper;
import com.neu.fenli2023623.service.DoctorService;
import com.neu.fenli2023623.vo.DoctorVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class DoctorServiceImpl implements DoctorService {
    @Autowired
    private DoctorMapper doctorMapper;

    @Override
    public List<DoctorVo> selectall() {
        return doctorMapper.selectAllDoctor();
    }//显示所有医生信息

    @Override
    public int addDoctor(DoctorDto doctor) {
        return doctorMapper.insert(doctor);
    }//添加医生信息

    @Override
    public int deleteDoctorById(Long id) {
        return doctorMapper.deleteByPrimaryKey(id);
    }//删除医生信息

    @Override
    public List<Doctor> selectDoctorByName(String name) {
        return doctorMapper.selectDoctorByName(name);
    }

    @Override
    public Doctor selectByPrimaryKey(Long id) {
        return doctorMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateDoctor(DoctorDto doctorDto) {
        return doctorMapper.updateByPrimaryKey(doctorDto);
    }
}
